require("plugin")


plugin.web = {
	new = function(p, url)
		local self = { plugin = p, url = url }
		setmetatable(self, { __index = plugin.web })
		return self
	end,
	
	activate = function(self)
		self:showWeb(self.url)
	end,
	
	deactivate = function(self)
	end,
	
	controlEvent = function(self, event)
		if event == "back" then
			self.plugin.stoicheia:showStartPage()
			return
		end
		if event == "previous" then
			self.plugin.stoicheia.gui.pagewin:back()
			return
		end
	end,
	
	pageEvent = function(self, event, arg)
		print("Page event:", event, arg)
	end,
	
	showWeb = function(self, url)
		self.plugin.stoicheia.gui.pagewin:scroll(true)
		self.plugin.stoicheia:setControls(false, "back", "previous")
		self.plugin.stoicheia.gui.pagewin:clearHistory(1)
		self.plugin.stoicheia.gui.pagewin:open(url)
		self.onweb = true
	end
}


